// This file was automatically generated from survey.soy.
// Please don't edit this file by hand.

goog.provide('esn.soy.survey');

goog.require('soy');
goog.require('soy.StringBuilder');


esn.soy.survey.questionList = function(opt_data, opt_sb) {
  var output = opt_sb || new soy.StringBuilder();
  output.append('<div class="questionList">');
  var questionList4 = opt_data.QuestionList;
  var questionListLen4 = questionList4.length;
  for (var questionIndex4 = 0; questionIndex4 < questionListLen4; questionIndex4++) {
    var questionData4 = questionList4[questionIndex4];
    if (questionData4.TYPE == esn.constants.QuestionType.SLIDER) {
      esn.soy.survey.sliderQuestion({Number: questionIndex4 + 1, Question: questionData4}, output);
    } else {
      esn.soy.survey.question({Number: questionIndex4 + 1, Question: questionData4}, output);
    }
  }
  output.append('</div>');
  return opt_sb ? '' : output.toString();
};


esn.soy.survey.question = function(opt_data, opt_sb) {
  var output = opt_sb || new soy.StringBuilder();
  output.append('<div class="questionSection ');
  esn.soy.survey.inlineCss(opt_data, output);
  output.append('"><div class="questionContainer"><div class="number">', soy.$$escapeHtml(opt_data.Number), '.</div><div class="question">', opt_data.Question.QUESTION, '</div><!-- If this is an INPUT_INLINE put the answer here. -->');
  if (opt_data.Question.TYPE == esn.constants.QuestionType.INPUT_INLINE) {
    esn.soy.survey.answer({Id: opt_data.Question.ID + '-' + opt_data.Question.POSSIBLE_ANSWERS[0], Name: opt_data.Question.ID, Answer: opt_data.Question.POSSIBLE_ANSWERS[0], QuestionType: opt_data.Question.TYPE, InputSize: opt_data.Question.INPUT_SIZE}, output);
  }
  output.append('<div style="clear: both;"></div></div>');
  if (opt_data.Question.TYPE != esn.constants.QuestionType.INPUT_INLINE) {
    output.append('<div class="answerContainer">');
    var answerList37 = opt_data.Question.POSSIBLE_ANSWERS;
    var answerListLen37 = answerList37.length;
    for (var answerIndex37 = 0; answerIndex37 < answerListLen37; answerIndex37++) {
      var answerData37 = answerList37[answerIndex37];
      esn.soy.survey.answer({Id: opt_data.Question.ID + '-' + answerData37, Name: opt_data.Question.ID, Answer: answerData37, QuestionType: opt_data.Question.TYPE, InputSize: opt_data.Question.INPUT_SIZE}, output);
    }
    output.append('</div>');
  }
  output.append('</div>');
  return opt_sb ? '' : output.toString();
};


esn.soy.survey.notApplicableCheckbox = function(opt_data, opt_sb) {
  var output = opt_sb || new soy.StringBuilder();
  output.append('<div class="notApplicableContainer"><input type="checkbox" id="notApplicableCheckbox-', soy.$$escapeHtml(opt_data.Question.ID), '" value="N/A"> <label for="notApplicableCheckbox-', soy.$$escapeHtml(opt_data.Question.ID), '">Not applicable, don\'t know or refused.</label></div>');
  return opt_sb ? '' : output.toString();
};


esn.soy.survey.sliderQuestion = function(opt_data, opt_sb) {
  var output = opt_sb || new soy.StringBuilder();
  output.append('<div class="questionSection sliderQuestion"><div class="questionContainer"><div class="number">', soy.$$escapeHtml(opt_data.Number), '.</div><div class="question"><table><tr><td class="questionTd">', opt_data.Question.QUESTION, '</td><td><div class="answerContainer"><div class="sliderContainer"><div class="slider"><div class="goog-slider-scale" ></div></div><div class="sliderValue">select a value</div></div></div></td></tr></table></div></div></div>');
  return opt_sb ? '' : output.toString();
};


esn.soy.survey.answer = function(opt_data, opt_sb) {
  var output = opt_sb || new soy.StringBuilder();
  if (opt_data.Answer == esn.constants.AnswerType.INPUT) {
    output.append('<div class="answer"><input type="text" id="', soy.$$escapeHtml(opt_data.Id), '" name="', soy.$$escapeHtml(opt_data.Name), '" size="');
    esn.soy.survey.inputSize(opt_data, output);
    output.append('" class=""></div>');
  } else if (opt_data.Answer == esn.constants.AnswerType.OTHER) {
    output.append('<div class="answer"><input type="', soy.$$escapeHtml(opt_data.QuestionType), '" id="', soy.$$escapeHtml(opt_data.Id), '" name="', soy.$$escapeHtml(opt_data.Name), '" value="', soy.$$escapeHtml(esn.constants.AnswerType.OTHER), '"> <label for="', soy.$$escapeHtml(opt_data.Id), '">Other</label> <input type="text" id="', soy.$$escapeHtml(opt_data.Id), ':', soy.$$escapeHtml(esn.constants.AnswerType.INPUT), '" size="');
    esn.soy.survey.inputSize(opt_data, output);
    output.append('"></div>');
  } else {
    output.append('<div class="answer"><input type="', soy.$$escapeHtml(opt_data.QuestionType), '" id="', soy.$$escapeHtml(opt_data.Id), '" name="', soy.$$escapeHtml(opt_data.Name), '" value="', soy.$$escapeHtml(opt_data.Answer), '"> <label for="', soy.$$escapeHtml(opt_data.Id), '">', soy.$$escapeHtml(opt_data.Answer), '</label></div>');
  }
  return opt_sb ? '' : output.toString();
};


esn.soy.survey.inlineCss = function(opt_data, opt_sb) {
  var output = opt_sb || new soy.StringBuilder();
  output.append((opt_data.Question.TYPE == esn.constants.QuestionType.INPUT_INLINE) ? 'inlineAnswer' : '');
  return opt_sb ? '' : output.toString();
};


esn.soy.survey.inputSize = function(opt_data, opt_sb) {
  var output = opt_sb || new soy.StringBuilder();
  output.append((opt_data.InputSize) ? soy.$$escapeHtml(opt_data.InputSize) : 'esn.constants.DEFAULT_INPUT_SIZE');
  return opt_sb ? '' : output.toString();
};
